<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%--
    Document   : blank
    Created on : 19.11.2008, 15:33:27
    Author     : Cyclone
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">


<body>


    <%--
    <c:if test="${!empty message}">
        <div id="box">
            <h3 id="adduser">Сообщение</h3>
            <p><span style="font-size:12px;">${message}</span>
        </div>
        <br />
    </c:if>
    --%>

    <%@include file="systemMessage.jsp" %>

    <div id="box" class="rounded-divcascade">
        <h3 class="reallynow">Тьюторы курса "${courseTitle}"</h3>
        <c:choose>
            <c:when test="${!empty userDelList}">
                <form id="form">
                    <table width="100%" id="courseDelTable" class="datatable" align="left">
                        <thead>
                            <tr>
                                <c:if test='<%= request.isUserInRole("admin")%>'>
                                    <th width="40px">ID</th>
                                </c:if>
                                <th>
                                    <img src="img/icons/arrow_down_mini.gif" width="16" height="16"/>
                                    ФИО</th>
                                <th>Email</th>
                                <c:if test='<%= request.isUserInRole("admin")%>'>
                                    <th width="60px"><a href="#">Операции</a></th>
                                </c:if>
                            </tr>
                        </thead>
                        <tbody>

                            <c:forEach var="userBean" items="${userDelList}">
                                <c:set var="found" value="true" />
                                <tr>
                                    <c:if test='<%= request.isUserInRole("admin")%>'>
                                        <td class="a-center">${userBean.account}</td>
                                    </c:if>
                                    <td><a href="Profile?id=${userBean.account}" title="Профиль">${userBean.name}</a></td>
                                    <td><a href="mailto:${userBean.login}" title="Отправить письмо">${userBean.login}</a></td>
                                    <c:if test='<%= request.isUserInRole("admin")%>'>
                                        <td style="padding: 0px;">
                                            <input type="button" value="Снять" onclick="window.location = 'SignTutorOff?courseId=${courseId}&userId=${userBean.account}'" style="margin: 0px; width: 100%;" />
                                        </td>
                                    </c:if>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </form>
            </c:when>
            <c:otherwise>
                <p>Список тьюторов пуст</p>
            </c:otherwise>
        </c:choose>

        <form id="form" style="text-align: center; clear: both;">
            <input type="button" value="К курсу" style="width: 25%;" onclick="window.location='Course?id=${courseId}'"/>
            <input type="button" value="К списку курсов" style="width: 25%;" onclick="window.location='Courses'" />
        </form>
    </div>

    <%--<c:if test='<%= request.isUserInRole("admin") %>'>--%>
    <c:if test="${sessionScope.roles.admin}">
        <br/>
        <div id="box" class="rounded-divcascade">
            <h3 class="reallynow">Назначение на курс "${courseTitle}"</h3>
            <c:choose>
                <c:when test="${!empty userAddList}">
                    <form id="form">
                        <table width="100%" id="courseAddTable" class="datatable" align="left">
                            <thead>
                                <tr>
                                    <th width="40px"><a href="#">ID<img src="img/icons/arrow_down_mini.gif" width="16" height="16" align="absmiddle" /></a></th>
                                    <th><a href="#">ФИО</a></th>
                                    <th><a href="#">Email</a></th>
                                    <th width="60px"><a href="#">Операции</a></th>
                                </tr>
                            </thead>
                            <tbody>

                                <c:forEach var="userBean" items="${userAddList}">
                                    <c:set var="found" value="true" />
                                    <tr>
                                        <td class="a-center">${userBean.account}</td>
                                        <td><a href="Profile?id=${userBean.account}" title="Профиль">${userBean.name}</a></td>
                                        <td><a href="mailto:${userBean.login}" title="Отправить письмо" >${userBean.login}</a></td>
                                        <td style="padding: 0px;">
                                            <input type="button" value="Назначить" onclick="window.location = 'SignTutorOn?courseId=${courseId}&userId=${userBean.account}'" style="margin: 0px; width: 100%;" />
                                        </td>
                                    </tr>
                                </c:forEach>
                            </tbody>
                        </table>
                    </form>
                </c:when>
                <c:otherwise>
                    <p>Список тьюторов пуст</p>
                </c:otherwise>
            </c:choose>
            <form id="form" style="text-align: center; clear: both">
                <input type="button" value="К курсу" style="width: 25%;" onclick="window.location='Course?id=${courseId}'"/>
                <input type="button" value="К списку курсов" style="width: 25%;" onclick="window.location='Courses'" />
            </form>
        </div>
    </c:if>


    <script type="text/javascript">
        $(document).ready(function(){
            $("#liCourses").addClass("current");
            $('div#top-panel p').text('Список тьюторов курса');

            doDatatable('courseAddTable');
            doDatatable('courseDelTable');
        });
    </script>
</body>

